// 入口文件
import Vue from 'vue'
//导入路由的包
import VueRouter from 'vue-router'
//安装路由模块
Vue.use(VueRouter)
//导入Vuex包
import Vuex from 'vuex'
//安装Vuex模块
Vue.use(Vuex)
//导入时间插件
import moment from 'moment'
//定义全局过滤器
Vue.filter('dataFormat', function (dataStr, pattern = "YYYY") {
    return moment(dataStr).format(pattern);
})
//安装axios
import axios from 'axios'
import Qs from 'qs'

Vue.prototype.axios = axios;
Vue.prototype.qs = Qs;
//导入自己的router.js路由模块
import router from './router.js'
//导入根组件
import app from './App.vue'
//导入Vue-resource组件
import VueResource from 'vue-resource'
//安装Vue-resource
Vue.use(VueResource)
//设置请求根路径
// Vue.http.options.root = 'http://zxdc.catsic.com:9090'
//表单提交格式
// Vue.http.options.emulateJSON = 'true'
//导入验证码
import SIdentify from './components/toolsContainer/identity.vue'

Vue.use(SIdentify)
//导入MUI的样式
import './lib/mui/css/mui.min.css'
import './lib/mui/css/icons-extra.css'
import './lib/mui/css/iconfont.css'
import './lib/mui/css/mui.picker.css'
import './lib/mui/css/mui.poppicker.css'
//导入自定义样式
import './lib/mycss/all_css.css'
import './lib/mycss/weui.css'
import './lib/mycss/base.css'
import './lib/mycss/my.css'



import mui from './lib/mui/js/mui.min.js'
Vue.prototype.mui = mui

//导入ELEMENT-UI组件
import Element from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'

Vue.use(Element)
import iView from 'iview'

Vue.use(iView)
//按需求导入Mint-UI组件
import {Header, Swipe, SwipeItem, Button, PaletteButton, Search, Field, Picker, Popup,Checklist,Spinner} from 'mint-ui';
//注册组件
Vue.component(Header.name, Header);
Vue.component(Swipe.name, Swipe);
Vue.component(SwipeItem.name, SwipeItem);
Vue.component(Button.name, Button);
Vue.component(PaletteButton.name, PaletteButton);
Vue.component(Search.name, Search);
Vue.component(Field.name, Field);
Vue.component(Picker.name, Picker);
Vue.component(Popup.name, Popup);
Vue.component(Checklist.name, Checklist);
Vue.component(Spinner.name, Spinner);

//创建一个vuex实例
var store = new Vuex.Store({
    state: {//this.$store.state.***
        username: '',
        loginFlag: false,
        dlhyFlag: true,
        hyclFlag: false,
        intervalId: null,// 在data上定义 定时器Id
        hyclitervalId: null,// 在data上定义 定时器Id
        value: [],
    },
    mutations: {//this.$store.commit('方法名','唯一参数')

        setResultList(resultList) {
            this.state.resultList = resultList;
        },
        changeLoginStatus(state) {
            state.loginFlag = true;  
        },
        outLogin(state) {
            state.loginFlag = false;
        },
    },
    getters: {//this.$store.getters.***

    }
})

var vm = new Vue({
    el: '#app',
    render: c => c(app),
    router,
    store
})
